<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //声明变量 var a;
    let a;
    let b,c,d,e;
    //赋值
    let f = 200;
    let g = 100, h = 200, i=300;

    //1. 不允许重复声明
    let star = '蔡徐坤';
    // let star = '坤坤';

    //2. 块儿作用域 if(){}   while(){}   for(){}
    // if(true){
    //   let test = 100;
    // }
    // console.log(test);

    //3. 不会进行预解析的变量提升
    // console.log(test2);
    // let test2 = 200;

    //4. 不影响作用域链效果
    function fa(){
      if(true){
        let b = 200;
        return function(){
          console.log(b);
        }
      }
    }
    let fn = fa();
    fn();

  </script>
</body>
</html>